package com.site_assembly.common;

import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;

import java.util.List;

public class BindingResultValidationUtil {


    //feign接口上不合适用bindingresult
    public static String  cheack(BindingResult bindingResult){
        List<FieldError> allErrors = bindingResult.getFieldErrors();
        StringBuilder strBuilder = new StringBuilder();
        for (FieldError error :allErrors){
            strBuilder.append(error.getField()+":"+error.getDefaultMessage()+";");
        }
        return strBuilder.toString();
    }
}
